<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../dialog.header.jsp"%>
<style type="text/css">
#dialogUserTreeDiv {
	height: 220px;
	width: 98%;
	border: 1px solid #CCCCCC;
	overflow:auto;
}
</style>
<script type="text/javascript">
var _tree;
var _curr_node;

function _refresh() {
	_curr_node = null;
	_tree.jstree("refresh","-1");
}

function _beforeConfirm(callback) {
	if (_curr_node == null) {
		$.alert("请选择人员！");
		return false;
	}
	var data = _curr_node.rslt.obj;
	callback(data);
	return true;
}

$("#dialogUserTreeDiv").ready(function() {
	_curr_node = null;
	/*
	_tree = $("#dialogUserTreeDiv").jstree({
		themes: {"theme" : "default"},
		json_data: { 
			ajax : {
				"url" : ctx + "/biz/system/user/tree.json",
				"method" : "GET",
				"async" : true,
				"cache" : false,
				"data" : function(node) {
					return {id:node.data ? node.data("id") : ""};
				},
				"success": function(data) {
					if (!data.succeed) {
						return [];
					}
					return data.data;
				}
			}
		},
		languages: ["zh"],
        "types" : {
        	"use_data" : true,
            "valid_children" : [ "organ" ],
            "types" : {
                "organ" : {
                    "valid_children" : [ "organ", "user" ],
                    "hover_node" : false,
                    "select_node" : false
                },
                "user" : {
                    "icon" : {
                        "image" : "http://static.jstree.com/v.1.0rc/_docs/_drive.png"
                    },
                   "valid_children" : [ "none" ]
                }
            }        },
		plugins: ["themes","json_data","ui","languages","types"]
	});
	*/
	_tree = $.readonlyTree("#dialogUserTreeDiv",ctx+"/biz/system/user/tree.json");
	_tree.bind("select_node.jstree",function(e,data) {
		_curr_node = data;
	});
});

</script>

<div id="dialogUserTreeDiv">
</div>
